UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9etSrAxF3dYlP5i6C917+3rX/Zz1bfy1L5dxSUmoVOE='
WHERE
key_id = 'e3a57f3e8dfb31b44233ca64b7b56237d36d9c06b25f65fcd366b57aabb476c0'
AND (
token = '9etSrAxF3dYlP5i6C917+3rX/Zz1bfy1L5dxSUmoVOE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)