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