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