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

Query time 0.00033