UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wZRTRDMaj/1WEl+bs0fKR9v0iyAYiEqNX93GjALK02g='
WHERE
key_id = 'b0f827eae07d28fa2735ddfbaeb3a26635e00d43209895ec902e452ef08ed614'
AND (
token = 'wZRTRDMaj/1WEl+bs0fKR9v0iyAYiEqNX93GjALK02g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)