UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'L3yUcxb+lAIWO/zNA0i8Jdm34jbWgULlSUrdnai56Hg='
WHERE
key_id = 'c2fce6d96d9e77674a8023ea38740eb5a46fec6a22ba6f29a363220283bb967e'
AND (
token = 'L3yUcxb+lAIWO/zNA0i8Jdm34jbWgULlSUrdnai56Hg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)