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