UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zmNs5R5f4LF6UFthkATNXzSRutasfzgVxaV4WyKX5Cw='
WHERE
key_id = '8e8b2b83cb4ccd635a621255458900104814ac6f3291a57de95330ea273d3c08'
AND (
token = 'zmNs5R5f4LF6UFthkATNXzSRutasfzgVxaV4WyKX5Cw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)