UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gHWFvp/c2nPdKTj5/BGp5tLQAEpQsYNsvmUFncvi79U=' 
WHERE 
  key_id = '768e20edd58582267181f4f59c2a6eff9fecadd3b2f1de7499e79b4bff12981e' 
  AND (
    token = 'gHWFvp/c2nPdKTj5/BGp5tLQAEpQsYNsvmUFncvi79U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044