UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QtcJiw6o1DDsvVGqQPXFWUF8LyS/0CeqSgwhjDglSzI='
WHERE
key_id = 'f9ca8dc140a1aeef553a234f53e83c8095e34c27f9486eb2f07f9fb3f8d8d01d'
AND (
token = 'QtcJiw6o1DDsvVGqQPXFWUF8LyS/0CeqSgwhjDglSzI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)