UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o+Nw0rBqgujiFZr8nkowwSF2C97YTzGzWPDzJ51S+5w='
WHERE
key_id = 'cb0fd255b329ba93630253f7444101b8a4039eb5834bf81e0ac12bd38d8fd86a'
AND (
token = 'o+Nw0rBqgujiFZr8nkowwSF2C97YTzGzWPDzJ51S+5w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)