UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i6vAKBbagXNb4kuve3axVaIKwYCmvtbXthLPvC3e+Hc='
WHERE
key_id = 'bbf589c77685afe6219feddd73a5b5ccb18c2647c6b49cb6fc6454e3ec8d02a6'
AND (
token = 'i6vAKBbagXNb4kuve3axVaIKwYCmvtbXthLPvC3e+Hc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)