UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '53Sm5oxUKORy5J1ymUjLH4+mg1+WGm83zzw4i6xeUX0='
WHERE
key_id = '734dc4c8ffcaf326e8180547632912e2502dab2268e9df860e261fb7bd9588b4'
AND (
token = '53Sm5oxUKORy5J1ymUjLH4+mg1+WGm83zzw4i6xeUX0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)