UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7Gb2teQPUtZUCnc+lO2HIRZ9BAhHpP+pRkEeEMcvcIw=' 
WHERE 
  key_id = 'fb50f02c13d902e31ef04f1dc41f816c6cc11d3747d79599c8fab09010b0df58' 
  AND (
    token = '7Gb2teQPUtZUCnc+lO2HIRZ9BAhHpP+pRkEeEMcvcIw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044