UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yMfpWGTmt/p1+FfY88qc3yREhvH2n3l5+pheBZTB1J4='
WHERE
key_id = 'd856916194255608f14b26a853ecea1d4103b713bc40dd9adfe7318be29df949'
AND (
token = 'yMfpWGTmt/p1+FfY88qc3yREhvH2n3l5+pheBZTB1J4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)