UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sP5uVZAQUkALT/cxAs1hB784ze6nA31u5yshmp3J9PM='
WHERE
key_id = '775477819b7a606391a5fff6b6b32f4cc074d3f4582f1688a00b1174c0118efc'
AND (
token = 'sP5uVZAQUkALT/cxAs1hB784ze6nA31u5yshmp3J9PM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)