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