UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QN/KMIh03voT8kh1RmRLtrQWuZB6Eja91lukNURur1E=' 
WHERE 
  key_id = '3e76a9e503553ee3a3b7c0a3e2d6af04208bed13c15a211a10737e11576f3383' 
  AND (
    token = 'QN/KMIh03voT8kh1RmRLtrQWuZB6Eja91lukNURur1E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00108