UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LAdFZDT9rS/w57FqhvYT9VPtSyjGQKxqgjBhJi9x7ZM=' 
WHERE 
  key_id = 'f821a78e1764696d8162a59ec9d1aeca04229b79b8fe87911d94a862515a5749' 
  AND (
    token = 'LAdFZDT9rS/w57FqhvYT9VPtSyjGQKxqgjBhJi9x7ZM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030