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