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