UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XrDv+9FZ6J8ZQIJf3xpkEGRfV3VtoV6Uz4R5y1XvawE=' 
WHERE 
  key_id = '33d5bab612675f16f745a5d91f3cc8880b1463287e6eebf1d2fa641080e5e40d' 
  AND (
    token = 'XrDv+9FZ6J8ZQIJf3xpkEGRfV3VtoV6Uz4R5y1XvawE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026