UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WGmOy+akORsRN0vW5IMVGSqc5qkHuEDh3S/J4Wu3wg8='
WHERE
key_id = 'aa77187049e8749d3ba9d58da942e01fac92536e7b774a8bb2a3093ba9068f1c'
AND (
token = 'WGmOy+akORsRN0vW5IMVGSqc5qkHuEDh3S/J4Wu3wg8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)