UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uJvbwTPYMh351J3axlV8Ah9qrw47kBYmT7GdyZpyTQI='
WHERE
key_id = 'e176e2bc9cd944f56b4843deb72111b64294d4490d74f298b84cfaa2db028fb6'
AND (
token = 'uJvbwTPYMh351J3axlV8Ah9qrw47kBYmT7GdyZpyTQI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)