UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1PKjPEOgXEpw7hblzrT0UgFkCPfv8uvAyu+yL8+7Gg8='
WHERE
key_id = 'b7ab2cfa402ab7d968f9266b25e59daf7e1bcb421ca5ac0932b3248e89a17d22'
AND (
token = '1PKjPEOgXEpw7hblzrT0UgFkCPfv8uvAyu+yL8+7Gg8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)