UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vDI4dyjfNCmrWZbU3Rva9k/A4f/MstztMW+HdOOrzR4=' 
WHERE 
  key_id = '5379d41b606e64663466b84ea83f84cdac7df1cb407d312a171f69c78d3ba9c7' 
  AND (
    token = 'vDI4dyjfNCmrWZbU3Rva9k/A4f/MstztMW+HdOOrzR4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026