UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3iJjzvUuAvXQRLK1NqFfD+bHEhPu+Y2gu2dqVJterWQ=' 
WHERE 
  key_id = 'a2984e8613abe02b8c7173300292449e8187110994d58f395a5387d4fcab949c' 
  AND (
    token = '3iJjzvUuAvXQRLK1NqFfD+bHEhPu+Y2gu2dqVJterWQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037