UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CpVkdwqhEYpEBZ3/kozrbd6ZYbKnEN0ghrcjC3v4jAQ=' 
WHERE 
  key_id = '4d28414efd7090b2d23590c56285ea6344c2605968ac0b484a9e887edf468dcb' 
  AND (
    token = 'CpVkdwqhEYpEBZ3/kozrbd6ZYbKnEN0ghrcjC3v4jAQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052