UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dCOHPMuSQKs7kIwJADMg17ZSUwypGQ5i7JFeh3U6f5g='
WHERE
key_id = '779ef82eb1923082942b373df7874005c8ff92cad1d30b5c78dc732e91edc032'
AND (
token = 'dCOHPMuSQKs7kIwJADMg17ZSUwypGQ5i7JFeh3U6f5g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)